package cn.school.controller.newExam;

import cn.school.common.api.CommonResult;
import cn.school.newExam.entity.ExamComment;
import cn.school.newExam.service.ExamCommentService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/examComment")
public class ExamCommentController {

    @Resource
    private ExamCommentService examCommentService;

    @PostMapping("/addOrUpdate")
    public CommonResult addOrUpdate(@RequestBody ExamComment examComment){
        return examCommentService.addOrUpdate(examComment) > 0 ? CommonResult.success() : CommonResult.failed();
    }

    @PostMapping("/getExamComment")
    public CommonResult getExamComment(@RequestBody ExamComment dto){
        ExamComment examComment = examCommentService.getExamComment(dto);
        return CommonResult.success(examComment);
    }
}
